<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="./vue.js"></script>
</head>
<body>
<div id="root">
    <div ref="myDiv">123</div>
    <button @click="fn">点我</button>
</div>
</body>
<script>
    new Vue({
        el: '#root',
        methods: {
            fn(){
                this.$refs.myDiv.style.color="red";
                console.log(this);
            }
        }
    })
</script>
</html>